package com.example.mapper;

import com.example.entity.Account;
import com.example.entity.ZyzStudent;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 志愿者学生表Mapper
 */
public interface ZyzStudentMapper {

    /**
     * 根据用户名查询志愿者学生表
     * @param username
     * @return
     */
    @Select("select * from zyz_student where username =#{username}")
    ZyzStudent selectByUsername(String username);

    /**
     * 添加
     * @param zyzStudent
     * @return
     */
    int insert(ZyzStudent zyzStudent);

    /**
     * 批量删除
     * @param
     * @return
     */
    int deleteBatch(String[] ids);

    /**
     * 修改
     * @param zyzStudent
     * @return
     */
    int updateById(ZyzStudent zyzStudent);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Select("select * from zyz_student where id =#{id}")
    ZyzStudent selectById(Integer id);

    /**
     * 查询所有
     * @param zyzStudent
     * @return
     */
    List<ZyzStudent> selectAll(ZyzStudent zyzStudent);

    @Select("select st.*,c.name as collegeName from zyz_student st join college c on st.college_id = c.id where st.username = #{username}")
    Account selectByUsername2(String username);

    /**
     * 查询总数量
     * @return
     */
    @Select("select count(*) from zyz_student")
    Integer selectCount();

    @Select("select * from zyz_student where id = #{id}")
    Account selectById2(Integer id);
}
